<?php

namespace app\api\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * 商品列表
 */
class PointOrder extends Model
{
    // protected static function base($query)
    // {
    //     $query->where('status',1);
    // }

    // protected $name='mall_goods';

    // 开启自动写入时间戳字段
    protected $auto_timestamp = 'false';
    // 设置json类型字段
	// protected $json = ['sf'];
 
      // 追加属性

      use SoftDelete;

      protected $deleteTime = 'delete_time';

      public function createOrder($uid, $gtype, $param, $sku, $addressData, $service_user_id, $order_no, $remark)
      {
        $data = ['uid'=>$uid, 'remark' => $remark,'status' => 2,'point' => $gtype['point'],'address' => $addressData['address'],'order_no' => $order_no,'type' => $gtype, 'province' => $addressData['province'],'city'=>$addressData['city'],'area'=>$addressData['area'],'lon'=>$addressData['lon'], 'lat'=>$addressData['lat']];
        $this->save($data);
        return $this->id;
      }

      public function getPayTimeAttr($value) {
         if ($value) {
             return date('Y-m-d H:i:s', $value);
         } else {
             return '';
         }         
      }
}
